From ca1acc5727928257767f5a3e8502c07b7b625fea Mon Sep 17 00:00:00 2001 From: Jan Likar Date: Sun, 9 Apr 2017 04:20:41 +0200 Subject: [PATCH] Improve "dirty" error message Improve the error message stating the working directory has dirty files (files not yet committed). Fix #3876. --- src/cargo/ops/cargo_package.rs | 3 ++- tests/package.rs | 3 ++- tests/publish.rs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index b0897b079..107a4f2a5 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -173,7 +173,8 @@ fn check_not_dirty(p: &Package, src: &PathSource) -> CargoResult<()> { if dirty.is_empty() { Ok(()) } else { - bail!("{} dirty files found in the working directory:\n\n{}\n\n\ + bail!("{} files in the working directory contain changes that were \ + not yet committed into git:\n\n{}\n\n\ to proceed despite this, pass the `--allow-dirty` flag", dirty.len(), dirty.join("\n")) } diff --git a/tests/package.rs b/tests/package.rs index fab868061..cbcf14683 100644 --- a/tests/package.rs +++ b/tests/package.rs @@ -580,7 +580,8 @@ fn do_not_package_if_repository_is_dirty() { assert_that(p.cargo("package"), execs().with_status(101) .with_stderr("\ -error: 1 dirty files found in the working directory: +error: 1 files in the working directory contain changes that were not yet \ +committed into git: Cargo.toml diff --git a/tests/publish.rs b/tests/publish.rs index 84b3ea128..1e4d71400 100644 --- a/tests/publish.rs +++ b/tests/publish.rs @@ -207,7 +207,8 @@ fn dont_publish_dirty() { .arg("--host").arg(registry().to_string()), execs().with_status(101).with_stderr("\ [UPDATING] registry `[..]` -error: 1 dirty files found in the working directory: +error: 1 files in the working directory contain changes that were not yet \ +committed into git: bar -- 2.30.2